<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <script src="../lib/vue2.js"></script>
  </head>
  <body>
    <div id="box">
      <input type="text" @input="handleInput" />
      <ul>
        <li v-for="item in showList()">{{item}}</li>
      </ul>
    </div>

    <script>
      let boxItem = new Vue({
        el: "#box",
        data: {
          infoList: ["aaaa", "bbbb", "cccc", "ddddd", "acdd", "bbcc"],
          mytext: "",
        },
        methods: {
          handleInput(evt) {
            this.mytext = evt.target.value;
          },
          showList() {
            showList = this.infoList.filter((item) => {
              return item.includes(this.mytext);
            });
            return showList;
          },
        },
      });
    </script>
  </body>
</html>
